<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html 		xmlns="http://www.w3.org/1999/xhtml"
			xmlns:ui="http://java.sun.com/jsf/facelets"
			xmlns:h="http://java.sun.com/jsf/html"
			xmlns:f="http://java.sun.com/jsf/core"
			xmlns:a4j="http://richfaces.org/a4j"
			xmlns:rich="http://richfaces.org/rich"
			xmlns:t="http://myfaces.apache.org/tomahawk">

	<head>
		<title>
			<h:outputText value="#{bundle.tituloAplicacao}" /> 
		</title>
		
		<link rel="stylesheet" type="text/css" href="/#{bundle.pathAplicacao}/css/geral.css" />
		<link rel="stylesheet" type="text/css" href="/#{bundle.pathAplicacao}/css/reset.css" />
		<link rel="stylesheet" type="text/css" href="/#{bundle.pathAplicacao}/css/estilo.css" />
		<link rel="stylesheet" type="text/css" href="/#{bundle.pathAplicacao}/css/interna.css" />
		<link rel="shortcut icon" href="/#{bundle.pathAplicacao}/_imgs/ico-gm.gif" />
		
		<!--  <script type="text/javascript" src="http://code.jquery.com/j2query-1.4.2.min.js"></script>
		<script type="text/javascript" src="/#{bundle.pathAplicacao}/script/jquery-1.4.2.min.js"></script>  -->
   		<script type="text/javascript" src="/#{bundle.pathAplicacao}/script/global.js"></script>
	</head>
	
	<body>
		
	<a4j:status onstart="temporizadorSessaoTomcatAjax();">
		<f:facet name="start">
            <div id="divLoadAjaxWait" 
	     		style="filter:alpha(opacity=60, finishopacity=60, style=1);
	            opacity:.3;-moz-opacity:.3;-khtml-opacity:.3;
	            position:absolute;text-align:center;
	            left : 0px; top 0px;
	            width:100%;height:100%;
	            background-color:#F1F1F1;z-index: 999;">
	        </div>
	        <div id="divProcessando" 
		        	style="display: block;background-color:transparent;
		            position:absolute;top:80px;left:100%;
		            width:100px;margin:0px auto auto -108px;z-index: 9999;">
		            
					 <table width="100%" align="center" style="background-color:transparent;">
					   	 <tr>
					       <td align="right" width="23"><img src="/#{bundle.pathAplicacao}/imagens/ajax-loader.gif" border="0"/></td>
					       <td align="left"><font style="font-size: 12px;" color="red"><b>processando</b></font></td>
					     </tr>
				     </table>
			</div> 
		</f:facet>
	</a4j:status>
		
		
		<div id="Site">
	        <div id="Side-a">
	          
	          <h1>GearMan - Conciliador de Transações Eletrônicas</h1>
	          <span id="Marcador-top"></span>
	            
	          <span id="Expandir">
	               <rich:jQuery timing="immediate"
	                    selector="#Expandir"
	                    query="
	                    	click(function(){
	                    	jQuery('#Side-a').toggleClass('fecha-menu');
	                    	jQuery('#Side-a-a').toggleClass('fecha-menu');
				   			jQuery('#Expandir').toggleClass('btn-fecha');
				   			jQuery('body').toggleClass('fecha-body');
							jQuery('#Site').toggleClass('fecha-site');
							jQuery('#Space').toggleClass('fecha-space');})" 
					 
				   />	
	            </span>  
	        </div>  
	         
	        <div id="Side-a-a">
	          
	            <div id="Menu-principal">
	            	<h:form id="menuForm">
	                  <ul>
	                    <li class="pai-menu">Consultas
	                      <ul class="sub-menu">
	                      	<li><h:commandLink value="#{bundle.titulo_movimentacao_vendas}" action="#{movimentacaoVendasBean.preparaPesquisar}"/></li>
	                      	<li><h:commandLink value="#{bundle.titulo_movimentacao_vendas_rede_adquirente}" action="#{movimentacaoVendasPorRedeAdquirenteBean.preparaPesquisar}"/></li>
	                      	<li><h:commandLink value="#{bundle.titulo_movimentacao_recebimentos}" action="#{movimentacaoRecebimentosBean.preparaPesquisar}" /></li>
							<li><h:commandLink value="#{bundle.titulo_extrato}" action="#{extratoBean.preparaPesquisar}" /></li>
							<li><h:commandLink value="#{bundle.menu_consulta_duplicidade}" action="#{consultaDuplicidadeBean.preparaPesquisar}" /></li>
							<li><h:commandLink value="#{bundle.menu_consulta_divergencias}" action="#{consultaDivergenciaBean.preparaPesquisar}" /></li>
							<li><h:commandLink value="#{bundle.menu_consulta_transacoes}" action="#{consultaTransacoesBean.preparaPesquisar}" /></li>
	                      </ul>
	                    </li>
	                    <li class="pai-menu">Integração            
	                      <ul class="sub-menu">
	                      	<li><h:commandLink value="#{bundle.menu_consulta_arquivo_vendas}" action="#{headerArquivoRemessaVendasBean.preparaPesquisar}" /></li>
	                      	<li><h:commandLink value="#{bundle.menu_arquivo_vendas}" action="#{uploadRemessaVendasBean.preparaPesquisar}" /></li>
	                      	<li><h:commandLink value="#{bundle.menu_gerar_arquivo}" action="#{gerarArquivoBean.preparaPesquisar}" rendered="#{loginBean.usuarioVo.estEmpresaVo.flagBaixaVenda.valor == 'YES'}" /></li>
							<li><h:commandLink value="#{bundle.menu_gerar_arquivo_baixa}" action="#{gerarArquivoBaixaBean.preparaPesquisar}" /></li>
							<li><h:commandLink value="#{bundle.menu_download}" action="#{downloadBean.preparaPesquisar}" /></li>
							<li><h:commandLink rendered="#{loginBean.usuarioVo.estEmpresaVo.flagIntegracao.valor == 'YES'}" value="#{bundle.menu_digitacao_cupom}" action="#{digitacaoCupomBean.preparaPesquisar}" /></li>
	                      </ul>
	                    </li>
	                    <li class="pai-menu">Segurança
	                      <ul class="sub-menu">
	                      	<li><h:commandLink value="#{bundle.menu_alterar_senha}" action="#{usuarioBean.preparaAlterarSenha}"/></li>
	                      </ul>
	                    </li>
	                  </ul>
                  </h:form>
				</div>
	            
	            <span id="Marcador-bottom"></span>
	            <h2>Um produto de BR Consultoria</h2>
	           
	        </div>
	        
	        <div id="Side-b">
	        	<div id="Top-sistema">
	            	<span id="Gearman-cinza">GearMan</span>
	                <ul id="Dados-logados">
	                    <li style="width: 400px"><span id="Negrito">Empresa: </span> <h:outputText value="#{loginBean.usuarioVo.estEmpresaVo.descricao}" /></li>
	                    <li style="width: 400px"><span id="Negrito">Nome: </span> <h:outputText value="#{loginBean.usuarioVo.nome}" /> <label class="textoSessao" id="temporizadorSessao" /></li>
	                </ul>
	                <p id="Desconectar">
		                <h:form id="logout">
	                        <ui:insert name="logout">
								<h:commandLink action="#{loginBean.logout}" value="Desconectar" />
	                        </ui:insert>
	                    </h:form>
	                </p>
	                <div id="Tabela">
	                	<table>
				       		<tr>
				       			<td id="Space"></td>
				       			<td>
				                   <h:panelGroup id="panelTitle">
				                       <table class="messageTable">
				                           <tr>
				                               <td class="tituloform">
				                                   <b>#{pageTitle}</b>
				                               </td>
				                           </tr>
				                           <tr>
				                               <td><ui:insert name="requiredFieldsMessage" /></td>
				                           </tr>
				                           <tr>
				                             <td>
				                               <a4j:outputPanel  ajaxRendered="true">
				                                   <h:messages layout="table" warnClass="msgWarm" errorClass="msgError" infoClass="msgInfo" id="messages"/>
				                               </a4j:outputPanel>
				                             </td>             
				                           </tr>
				                       </table>
				                   </h:panelGroup>
				                   
				                   <br />
				
				                   <a4j:form id="formulario">
				                       <a4j:loadScript src="/script/jquery.maskedinput-1.2.2.js" />
				                       <a4j:loadScript src="/script/jquery.price_format.1.2.js" />
				                       <a4j:loadScript src="/script/util.js" />
				                       
				                       <ui:insert name="saveStateObjects" />
										<ui:insert name="saveStateObjectsDefined" />
				                   
				                       <ui:insert name="content" />
				                       
				                       <ui:insert name="buttons">
				                           <div id="botao" style="visibility: visible;">
				                               <table class="buttonTable">
				                                   <tr>
				                                       <td class="buttonItem">
				                                           <ui:insert name="buttonItens"/>
				                                       </td>
				                                   </tr>
				                               </table>
				                           </div>
				                       </ui:insert>
				                       
				                       <br/>
				                       
				                       <ui:insert name="list"/>
				                   </a4j:form>
				       			</td>
				       		</tr>
				       </table>
				       </div>
	            </div>
	        </div>
        </div>
        
        
        
        <script type="text/javascript">
			
			var parseSessao;

			//mantendo a div processando sempre cobrindo todo o corpo da pagina
			function beginrefresh()
			{
				
				var bodyTop = jQuery(window).scrollTop();
				
				document.getElementById('divLoadAjaxWait').style.top = bodyTop + 'px';
				
				if (40 > bodyTop)
				{
					document.getElementById('divProcessando').style.top = bodyTop + 40 + 'px';
				}
				else
				{
					document.getElementById('divProcessando').style.top = bodyTop + 5 + 'px';
				}
				
				if (parseSessao!=0)
				{ 
					parseSessao--;
					curhor=Math.floor((parseSessao/60)/60);
					curmin=Math.floor((parseSessao/60)%60);
					cursec=parseSessao%60;
					if(curhor != 0)
						if(curmin > 9)
							if(cursec > 9)
								curtime="0" + curhor + ":" + curmin + ":" + cursec;
							else
								curtime="0" + curhor + ":" + curmin + ":0" + cursec;
						else
							if(cursec > 9)
								curtime="0" + curhor + ":0" + curmin + ":" + cursec;
							else
								curtime="0" + curhor + ":0" + curmin + ":0" +cursec;
					else 
						if (curmin!=0)
							if(curmin > 9)
								if(cursec > 9)
									curtime= curmin + ":" + cursec;
								else
									curtime= curmin + ":0" +cursec;
							else
								curtime="0" + curmin + ":" + cursec;
						else
							curtime = cursec;
			        
					document.getElementById('temporizadorSessao').innerHTML = ' >> sessão expira em ' + curtime;
					setTimeout("beginrefresh()",1000);
				}
				else
				{
					jsfcljs(document.forms['logout'],'logout:j_id41,logout:j_id41','');
				}
			}
			
			function temporizadorSessaoTomcat()
			{
				parseSessao = ${sessionScope.tempoSessao} - 5;
				beginrefresh();
			};

			function temporizadorSessaoTomcatAjax()
			{
				parseSessao = ${sessionScope.tempoSessao} - 5;
				clearTimeout(SetTime);
				beginrefresh();
			}
			
			temporizadorSessaoTomcat();

		</script>
        
        
	</body>
</html>